<?php 
/**
 * 评论Widget
 * @author tangbl
 *
 */
class CommentWidget extends Widget {
	
	public function render($id){
		
		$model = M("Comment");
		$map['pid']       = 1 ;
	  //$map['ischecked'] = 2 ;
		
		import('ORG.Util.Page');
		$pageNum   = I("get.pageNum",C('web_admin_pagenum'),"intval");
			
		$count     = $model->where($map)->count();
		$Page      = new Page($count);
		$nowPage   = isset($_GET['p'])?$_GET['p']:1;
		$list      = $model->where($map)->order("addtime desc")
					->field("content",true)->page($nowPage.','.$pageNum)->select();
		
		$data['list']  = $list;
		$data['count'] = $count;

		return $this->renderFile(TMPL_PATH.NOW_THEME_NAME."/Widget/comment.html", $data);
	}
}